import tkinter as tk

from click import command

# 创建Form
root = tk.Tk()
root.title("用户登录")
root.geometry("400x300")
root.maxsize(400, 300)


# 创建一个用户名标签
tk.Label(root, text="用户名：").grid(padx=30,pady=30,row=2, column=0)
# 创建一个单行输入文本框
username_entry = tk.Entry(root)
username_entry.grid(row=2, column=1)

# 创建密码输入标签和密码输入框
tk.Label(root, text="密码：").grid(row=4, column=0)
password_entry = tk.Entry(root)
password_entry.grid(row=4, column=1)

def login():
    username = username_entry.get()
    password = password_entry.get()
    print(f"用户名：{username}，密码：{password}")

# 登录按钮
button1 = tk.Button(root, text="登录",command=login)
button1.grid(padx=30,pady=30,row=6, column=0)

# 退出按钮
button2 = tk.Button(root, text="退出")
button2.grid(row=6, column=1)

# 运行窗体
root.mainloop()